﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace Ewts.Storage
{
    public partial class LoadNumListByAdd : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                BindData();
            }
        }

        protected void BindData()
        {
            if (Request["add"] != null && Request["add"].ToString().Trim() != "")
            {
                string addressid = Request["add"].ToString();
                DataTable dt = new DataTable();
                dt = new DataLib.BLL.LoadNum().GetList("addressid=" + addressid).Tables[0];
                rept.DataSource = dt;
                rept.DataBind();

            }
        }

        /// <summary>
        /// 根据客户ID获取业务员或者公司名称
        /// </summary>
        /// <param name="customerid"></param>
        /// <param name="issaleman"></param>
        /// <returns></returns>
        public string GetName(string customerid, int issaleman)
        {
            DataLib.Model.Cumtomer cummodel = new DataLib.Model.Cumtomer();
            cummodel = new DataLib.BLL.Cumtomer().GetModel(int.Parse(customerid));
            if (issaleman == 0)
                return cummodel.SaleMan;
            else
                return cummodel.companyname;

        }

        public string GetAddress(string addressid)
        {
            DataLib.Model.CumtomerAddress addmodel = new DataLib.Model.CumtomerAddress();
            addmodel = new DataLib.BLL.CumtomerAddress().GetModel(int.Parse(addressid));
            return addmodel.address;
        }
 
    }
}